package edu.xmut.kakamusic.viewmodel;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import java.util.ArrayList;
import java.util.List;

import edu.xmut.kakamusic.bean.entity.Bar;
import edu.xmut.kakamusic.bean.entity.Line;

public class BarViewModel extends ViewModel {
    private MutableLiveData<List<Bar>> barList;

    public BarViewModel() {
        barList = new MutableLiveData<>();
        String[] years = new String[]{"毕业生", "1-3年", "3-4年", "4-5年", "5-9年", "9-10年", "10年"};
        int[] salaries1 = {6000, 13000, 20000, 26000, 35000, 50000, 100000};
        int[] salaries2 = {4000, 10000, 15000, 19000, 20000, 40000, 70000};
        List<Bar> value = new ArrayList<>();
        for (int i = 0; i < years.length; i++) {
            Line line1 = new Line(years[i], salaries1[i]);
            Line line2 = new Line(years[i], salaries2[i]);
            value.add(new Bar(line1, line2));
        }
        barList.setValue(value);
    }

    public LiveData<List<Bar>> getBarList() {
        return barList;
    }
}
